<template>
  <div>
    <header>头部</header>
    <input type="text" placeholder="请输入任务" v-model="value" @keydown.enter="goto">
  </div>
</template>
<script>
import {ref} from 'vue'
export default {
  name:'navheader',
  setup(props,ctx) {
    let value=ref('')
    //回车事件
    let goto=()=>{
        // console.log(111);
        ctx.emit('add',value.value)
        //清空
        value.value=''
    }
    return{value,goto}
  }
}
</script>
<style lang="scss" scoped>

</style>